package com.glsc.ngateway.common.base.domain.postgre6;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author: qiyr
 * @date: 2023/4/4 17:08
 * @description: 国泰TRS估值表
 */
@Data
@Entity
@Table(name = "t_excel_trs_gtja_gzb")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@IdClass(TrsGtjaGzb.PK.class)
public class TrsGtjaGzb {

    public static class PK implements Serializable {
        private String date;
        private String trdno;

        public String getDate() {
            return date;
        }

        public void setDate(String date) {
            this.date = date;
        }

        public String getTrdno() {
            return trdno;
        }

        public void setTrdno(String trdno) {
            this.trdno = trdno;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            PK pk = (PK) o;
            return Objects.equals(date, pk.date) && Objects.equals(trdno, pk.trdno);
        }

        @Override
        public int hashCode() {
            return Objects.hash(date, trdno);
        }
    }

    @Id
    @Column(name = "fc_date")
    @ExcelProperty("估值日期")
    private String date;

    @Column(name = "fc_counterparty")
    @ExcelProperty("交易对手")
    private String counterparty;

    @Id
    @Column(name = "fc_trdno")
    @ExcelProperty("交易编号")
    private String trdno;

    @Column(name = "fc_zxy")
    @ExcelProperty("主协议")
    private String zxy;

    @Column(name = "ff_principal")
    @ExcelProperty("名义本金")
    private Double principal;

    @Column(name = "fc_trade_date")
    @ExcelProperty("交易日")
    private String tradeDate;

    @Column(name = "fc_begin_date")
    @ExcelProperty("起始日")
    private String beginDate;

    @Column(name = "fc_end_date")
    @ExcelProperty("到期日")
    private String endDate;

    @Column(name = "ff_pl")
    @ExcelProperty(value = "损益")
    private Double pl;

    @Column(name = "ff_amount")
    @ExcelProperty(value = "初始金额")
    private Double amount;

    @Column(name = "ff_trs")
    @ExcelProperty("TRS估值")
    private Double trs;

    public TrsGtjaGzb() {
    }

    public TrsGtjaGzb(String date, String counterparty, String trdno, String zxy, Double principal,
                      String tradeDate, String beginDate, String endDate, Double pl, Double amount, Double trs) {
        this.date = date;
        this.counterparty = counterparty;
        this.trdno = trdno;
        this.zxy = zxy;
        this.principal = principal;
        this.tradeDate = tradeDate;
        this.beginDate = beginDate;
        this.endDate = endDate;
        this.pl = pl;
        this.amount = amount;
        this.trs = trs;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getCounterparty() {
        return counterparty;
    }

    public void setCounterparty(String counterparty) {
        this.counterparty = counterparty;
    }

    public String getTrdno() {
        return trdno;
    }

    public void setTrdno(String trdno) {
        this.trdno = trdno;
    }

    public String getZxy() {
        return zxy;
    }

    public void setZxy(String zxy) {
        this.zxy = zxy;
    }

    public Double getPrincipal() {
        return principal;
    }

    public void setPrincipal(Double principal) {
        this.principal = principal;
    }

    public String getTradeDate() {
        return tradeDate;
    }

    public void setTradeDate(String tradeDate) {
        this.tradeDate = tradeDate;
    }

    public String getBeginDate() {
        return beginDate;
    }

    public void setBeginDate(String beginDate) {
        this.beginDate = beginDate;
    }

    public String getEndDate() {
        return endDate;
    }

    public void setEndDate(String endDate) {
        this.endDate = endDate;
    }

    public Double getPl() {
        return pl;
    }

    public void setPl(Double pl) {
        this.pl = pl;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Double getTrs() {
        return trs;
    }

    public void setTrs(Double trs) {
        this.trs = trs;
    }
}
